<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=502959
-->
<head>
  <title>Test for Bug 502959</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=502959">Mozilla Bug 502959</a>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 502959 **/
// Whatever you do don't use the word "wrapped" in this function.
function foo() {
  ok(true, "Able to call the function");
}

var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo, false);
var doublewrapped = iter.filter;

ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object back");

(function () {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    Components.utils.forceGC();
})();

doublewrapped.acceptNode(document);

</script>
</pre>
</body>
</html>
